<?php
use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use app\assets\AppAsset;
use yii\helpers\Url;
use yii\web\View;
/* @var $this \yii\web\View */
/* @var $content string */
AppAsset::register($this);
$this->registerJsFile(YII_ENV_PROD ? "//cdn.vamaker.com/static/modernizr-2.8.3.min.js" : Yii::getAlias('@web/').Yii::$app->params['envDir']."/js/libs/modernizr-2.8.3.min.js", ['position' => View::POS_HEAD]);
$switchUrl = Url::to(['home/brand-switch']);
$sysDefaultUrl = Url::to(['home/dashboard']);
$language = $this->context->cookieLanguage;
$this->registerJs("VAM.setVar('LANGUAGE', '".$language."');", View::POS_HEAD);
$this->registerJs("VAM.setVar('BRAND_SWITCH_URL', '$switchUrl')", View::POS_HEAD);
$this->registerJs("VAM.setVar('SYS_DEFAULT_URL','$sysDefaultUrl');", View::POS_HEAD);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
    <meta charset="<?= Yii::$app->charset ?>"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="<?= Yii::getAlias('@web');?>/favicon.ico">
    <?= Html::csrfMetaTags() ?>
    <title><?= Html::encode($this->title) ?></title>
    <?php $this->head() ?>
<!-- [if lt IE 9]>
  <script src="<?= Yii::getAlias('@web').'/js/vendor/html5.js'?>"></script>
  <script src="<?= Yii::getAlias('@web').'/js/vendor/excanvas.min.js'?>"></script>
  <script src="<?= Yii::getAlias('@web').'/js/vendor/respond.min.js'?>"></script>
<![endif] -->
</head>
<body class=" <?= isset($_COOKIE['vam_dsp_page_sider_closed']) && $_COOKIE['vam_dsp_page_sider_closed']=='true' ? 'page-sider-closed' : ''; ?>">

<?php $this->beginBody() ?>
<!--[if lt IE 7]>
  <p class="alert alert-info">
      You are using an <strong>outdated</strong>
      browser. 
      Please <a href="http://browsehappy.com/" class="alert-link">upgrade your browser</a> to improve your experience.
  </p>
<![endif]-->
  <div class="wrap">
    <input type="hidden" id="current-header" value="<?= Yii::$app->controller->currentHeader; ?>"> 
    <input type="hidden" id="current-navigator" value="<?= Yii::$app->controller->currentNav; ?>"> 
    <header class="header-wrap clearfix" id="header-wrap">
      <div class="navbar-header">
        <button type="button" class="navbar-toggle pull-left" data-toggle="collapse" data-target="#global-sider-menu">
          <span class="sr-only">Toggle navigation</span>
          <i class="fa fa-align-justify fa-lg"></i>
        </button>
        <!-- <a class="navbar-brand" href="<?php echo Url::to(['home/dashboard']); ?>" title="vivaki Ad server">
          <img style="height: 100%;" src="<?php echo Yii::getAlias('@web/').Yii::$app->params['envDir'];?>/img/new-logo.png" alt="vivaki Ad server" class="img-rounded">
        </a> -->
        <div class="pull-right top-menu" id="global-top-phone-menu">
          <ul class="nav navbar-nav list-inline">
            <li>
              <a title="用户信息" href="/home/user-update">
                <i class="fa fa-user"></i>
              </a>
            </li>
            <li>
              <a title="退出" href="/site/logout">
                <i class="fa fa-power-off"></i>
              </a>
            </li>
          </ul>
        </div>
      </div>
      <nav class="collapse navbar-collapse headerbar" role="navigation" id="header-nav-wrap">
        <ul class="nav navbar-nav">
          <li class="">
            <a href="javascript:void(0);" class="sider-menu-toggle">
              <i class="fa fa-align-justify fa-lg"></i>
            </a>
          </li>
        </ul>
        <ul class="nav navbar-nav pull-right">
            <!--
          <li class="dropdown">
            <a href="<?php echo Url::to(['site/message']); ?>">
              <i class="fa fa-envelope"></i>
              消息
            </a>
          </li>
            -->
          <li class="dropdown">
            <a href="#" data-toggle="dropdown" class="dropdown-toggle" aria-expanded="true">
              <i class="fa fa-user"></i>
              <?= $_SESSION['user_name'] ?>
              <span class="caret"></span>
            </a>
            <ul role="menu" class="dropdown-menu">
              <li>
                <a href="<?= Url::to(['home/user-update']);?>">
                  <i class="fa fa-wrench"></i>
                  <?=\Yii::t('common', 'Update Password')?>
                </a>
              </li>
            </ul>
          </li>
          <li class="dropdown top-lang-info">
            <a href="javascript:void(0);" class="dropdown-toggle" id="top-user-info" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" title="">
            <?php
              if($_SESSION['language'] === 'zh-CN') {
            ?>
              <img src="<?= Yii::getAlias('@web/').Yii::$app->params['envDir'];?>/img/flags/cn.png" alt="Chinese">
              中文
            <?php
              } else if ($_SESSION['language'] === 'en-US') {
            ?>
              <img src="<?= Yii::getAlias('@web/').Yii::$app->params['envDir'];?>/img/flags/us.png" alt="English">
              English
            <?php
              }
            ?>
              <span class="caret"></span>
            </a>
            <ul class="dropdown-menu" role="menu" style="min-width: 120px;">
              <li>
                <a class="" href="<?=Url::to(['site/set-sys-language', 'lang' => 'zh-CN']);?>" title="<?=Yii::t('site', 'Switch to Chinese')?>">
                  <img src="<?= Yii::getAlias('@web/').Yii::$app->params['envDir'];?>/img/flags/cn.png" alt="Chinese">
                  中文
                </a>
              </li>
              <li>
                <a class="" href="<?=Url::to(['site/set-sys-language', 'lang' => 'en-US']);?>" title="<?=Yii::t('site', 'Switch to English')?>">
                  <img src="<?= Yii::getAlias('@web/').Yii::$app->params['envDir'];?>/img/flags/us.png" alt="English">
                  English
                </a>
              </li>
            </ul>
          </li>
          <li class="dropdown">
            <a href="<?php echo Url::to(['site/logout']); ?>" title="<?=Yii::t('site', 'Logout')?>">
              &nbsp;<i class="fa fa-power-off"></i>&nbsp;
            </a>
          </li>
        </ul>
      </nav>
    </header>
    <div class="sidebar-nav nav-collapse collapse" id="global-sider-menu">
      <!-- system logo-->
      <a class="system-logo" href="/home/dashboard" title="<?=\Yii::$app->params['sysMsg']['company']?> Ad Server">
        <img src="<?php echo Yii::getAlias('@web/').Yii::$app->params['envDir'];?>/img/new-logo.png" alt="<?=\Yii::$app->params['sysMsg']['company']?> Agent Server">
        <p class="text-center"><?=\Yii::$app->params['sysMsg']['company']?> Agent Server</p>
      </a>
      <!-- /system logo-->
      <!-- nav search -->
      <div class="nav-search" style="display:none;">
        <div class="input-group">
          <input class="form-control nav-search-input" type="text" placeholder="<?=\Yii::t('common', 'search')?>...">
          <div class="input-group-btn">
            <button class="btn btn-default" id="nav-search" title="<?=\Yii::t('common', 'click to search')?>">
              <i class="fa fa-search"></i>
            </button>
          </div>
        </div>
      </div>
      <!-- /nav search -->
      <!-- user info -->
      <div class="user-side clearfix">
        <img class="img-circle"  src="<?= Yii::getAlias('@web/').Yii::$app->params['envDir'];?>/img/avatar/avatar-default.png" alt="User Avatar">
        <h5 title="vamaker-rd">vamaker-rd</h5>
        <!-- <a href="/site/settings" title="用户设置">
        <i class="fa fa-cog"></i> 设置
      </a> -->
        <a href="/user/infos" title="<?=\Yii::t('common', 'Account Info')?>">
          <i class="fa fa-user"></i> <?=\Yii::t('common', 'Account Info')?>
        </a>
        <a href="/user/modify-pwd" title="<?=\Yii::t('common', 'Update Password')?>">
          <i class="fa fa-key"></i> <?=\Yii::t('common', 'Update Password')?>
        </a>
        <!-- <a href="/user/user-message" title="消息列表">
        <i class="fa fa-envelope"></i> 消息列表
      </a> -->
      </div>
      <!-- user language -->
      <div class="user-language clearfix">
        <ul class="list-inline">
          <li>
            <?=\Yii::t('site', 'Language')?>:
          </li>
          <li>
            <a class="" href="<?=Url::to(['site/set-sys-language', 'lang' => 'zh-CN']);?>" title="<?=Yii::t('site', 'Switch to Chinese')?>">
              <img src="<?= Yii::getAlias('@web/').Yii::$app->params['envDir'];?>/img/flags/cn.png" alt="Chinese">
              中文
            </a>
          </li>
          <li>
            <a class="" href="<?=Url::to(['site/set-sys-language', 'lang' => 'en-US']);?>" title="<?=Yii::t('site', 'Switch to English')?>">
              <img src="<?= Yii::getAlias('@web/').Yii::$app->params['envDir'];?>/img/flags/us.png" alt="English">
              English
            </a>
          </li>
        </ul>
      </div><!-- user language -->
      <!-- sidebar nav -->
      <nav class="accordion">
        <ul class="list-unstyled">
          <li class="<? if($this->context->currentHeader == 'header-site'){echo " active";} ?>">
            <a class="" href="<?php echo Url::to(['home/dashboard']); ?>" title="Dashboard">
              <i class="fa fa-dashboard"></i>
              <span class="selected"></span>
              <span class="title">Dashboard</span>
            </a>
          </li>
          <?php
              $active = "";
              if($this->context->currentHeader == 'header-campaign')  $active = " active";
              $labelClass = "";
              if($this->context->currentNav == 'label-nav')   $labelClass = " current";
              $management = \Yii::t('common', 'Entity Management');
              $label = \Yii::t('common', 'Campaign Label');
              $labelUrl = Url::to(['campaign-label/label-list']);
              $launchClass = "";
              if($this->context->currentNav == 'launch-nav')    $launchClass = " current";
              $launchUrl = Url::to(['launch/launch-list']);
              $campaign = \Yii::t('common', 'Campaign');
              $solutionClass = "";
              if($this->context->currentNav == 'solution-nav')    $solutionClass = " current";
              $solutionUrl = Url::to(['solution/solution-list']);
              $solution = \Yii::t('common', 'Solution');
              $creativeClass = "";
              if($this->context->currentNav == 'creative-nav')    $creativeClass = " current";
              $creativeUrl = Url::to(['creative/creative-list']);
              $creative = \Yii::t('common', 'Creative');

              $entityManagement = <<<FINE
              <li class="$active">
                <a href="javascript:void(0);" class="has-sub" title="$management">
                  <i class="fa fa-tasks"></i>
                  <span class="title">$management</span>
                  <span class="selected"></span>
                  <span class="pull-right arrow">
                  <i class="fa fa-chevron-right "></i>
                </span>
                </a>
                <ul class="list-unstyled sub-nav">
                  <li class="nav-title">$label</li>
                  <li class="$labelClass">
                    <a href="$labelUrl" title="$label">
                      <i class="fa fa-globe"></i> $label
                    </a>
                  </li>
                  <li class="nav-title">$campaign</li>
                  <li class="$launchClass">
                    <a href="$launchUrl" title="$campaign">
                      <i class="fa fa-rocket"></i> $campaign
                    </a>
                  </li>
                  <li class="nav-title">$solution</li>
                  <li class="$solutionClass">
                    <a href="$solutionUrl" title="$solution">
                      <i class="fa fa-puzzle-piece"></i> $solution
                    </a>
                  </li>
                  <li class="nav-title">$creative</li>
                  <li class="$creativeClass">
                    <a href="$creativeUrl" title="$creative">
                      <i class="fa fa-sun-o"></i> $creative
                    </a>
                  </li>
                </ul>
              </li>
FINE;
          if (in_array($_SESSION['user_rank'], ['root', 'operator', 'agent', 'advertiser']))
              echo $entityManagement;
          ?>
  <!--         <li class="<? if($this->context->currentHeader == 'header-resource'){echo " active";} ?>">
            <a href="javascript:void(0);" class="has-sub" title="<?=\Yii::t('common', 'Resource')?>">
              <i class="fa fa-star"></i>
              <span class="title"><?=\Yii::t('common', 'Resource')?></span>
              <span class="selected"></span>
              <span class="pull-right arrow">
              <i class="fa fa-chevron-right "></i>
            </span>
            </a>
            <ul class="list-unstyled sub-nav">
              <li class="nav-title"><?=\Yii::t('common', 'Adspace')?></li>
              <li class="<? if($this->context->currentNav == 'media-list-nav'){echo " current";} ?>">
                <a href="<?php echo Url::to(['media-list/adspace-list']); ?>" title="<?=\Yii::t('common', 'Adspace')?>">
                  <i class="fa fa-sitemap"></i> <?=\Yii::t('common', 'Adspace')?>
                </a>
              </li> -->
            <?php
              $resourceClass = "";
              if ($this->context->currentHeader == 'header-resource')   $resourceClass = " active";
              $resource = \Yii::t('common', 'Resource');
              $adspaceClass = "";
              if ($this->context->currentNav == 'media-list-nav')   $adspaceClass = " current";
              $adspace =\Yii::t('common', 'Adspace');
              $adspaceUrl = Url::to(['media-list/adspace-list']);
              $packClass = "";
              if ($this->context->currentNav == 'pack-list-nav')   $packClass = " current";
              $pack =\Yii::t('common', 'Pack List');
              $packUrl = Url::to(['pack/pack-list']);
              $templateClass = "";
              if($this->context->currentNav == 'creative-template-nav')   $templateClass = " current";
              $template = \Yii::t('common', 'Creative Template');
              $templateUrl = Url::to(['creative-template/template-list']);
              $pmpClass = "";
              if($this->context->currentNav == 'pmp-list-nav')   $pmpClass = " current";
              $pmpList = \Yii::t('common', 'PMP List');
              $pmpResourceUrl = Url::to(['pmp-list/pmp-list']);
              $templateOP = <<<FINE
            <li class="$resourceClass">
              <a href="javascript:void(0);" class="has-sub" title="$resource">
                <i class="fa fa-star"></i>
                <span class="title">$resource</span>
                <span class="selected"></span>
                <span class="pull-right arrow">
                <i class="fa fa-chevron-right "></i>
              </span>
              </a>
              <ul class="list-unstyled sub-nav">
                <!-- li class="nav-title">$adspace</li>
                <li class="$adspaceClass">
                  <a href="$adspaceUrl" title="$adspace">
                    <i class="fa fa-sitemap"></i> $adspace
                  </a>
                </li -->
                <li class="nav-title">$pack</li>
                <li class="$packClass">
                  <a href="$packUrl" title="$pack">
                    <i class="fa fa-sitemap"></i> $pack
                  </a>
                </li>
FINE;
                echo $templateOP;
              $templateOP = <<<FINE
                <li class="nav-title">$pmpList</li>
                <li class="$pmpClass">
                  <a href="$pmpResourceUrl" title="$pmpList">
                    <i class="fa fa-line-chart"></i> $pmpList
                  </a>
                </li>
                <li class="nav-title">$template</li>
                <li class="$templateClass">
                  <a href="$templateUrl" title="$template">
                    <i class="fa fa-cube"></i> $template
                  </a>
                </li>
FINE;
              if (in_array($_SESSION['user_rank'], ['root', 'operator', 'agent']))
                  echo $templateOP;
                echo $template = <<<FINE
              </ul>
            </li>
FINE;
            ?>
  <!--           </ul>
          </li> -->



          <li class="<? if($this->context->currentHeader == 'header-report'){echo " active";} ?>">
            <a href="javascript:void(0);" class="has-sub" title="<?=\Yii::t('common', 'Reports')?>">
              <i class="fa fa-files-o"></i>
              <span class="title"><?=\Yii::t('common', 'Reports')?></span>
              <span class="selected"></span>
              <span class="pull-right arrow">
              <i class="fa fa-chevron-right "></i>
            </span>
            </a>
            <ul class="list-unstyled sub-nav">
              <li class="nav-title"><?=\Yii::t('common', 'Campaign Report')?></li>
              <li class="<? if($this->context->currentNav == 'report-nav'){echo " current";} ?>">
                <a href="<?php echo Url::to(['report/campaign-report']); ?>" title="<?=\Yii::t('common', 'Campaign Report')?>">
                  <i class="fa fa-table"></i> <?=\Yii::t('common', 'Campaign Report')?>
                </a>
              </li>
            </ul>
          </li>
          <!-- ------------------ 运营管理 beg ------------------ -->

        <?php
          $assetsClass = "";
          if ($this->context->currentHeader == 'header-operation')   $assetsClass =  " active";
          $assets = \Yii::t('common', 'Assets');
          $assetsOp = <<<FINE
            <li class="$assetsClass">
              <a href="javascript:void(0);" class="has-sub" title="$assets">
                <i class="fa fa-sliders"></i>
                <span class="title">$assets</span>
                <span class="selected"></span>
                <span class="pull-right arrow">
                <i class="fa fa-chevron-right"></i>
              </span>
              </a>
              <ul class="list-unstyled sub-nav">
FINE;
        if (in_array($_SESSION['user_rank'], ['root', 'operator', 'agent']))
          echo $assetsOp;
        ?>

    <?php 
        $monitor = Url::to(['summary-report/summary-report']);
        $summary = Url::to(['summary-report/summary-report']);
        $profitSetting = Url::to(['profit-setting/profit-setting-list']);
        $solutionAuditManager = Url::to(['solution-audit/audit-list']);
        $advertiserManager = Url::to(['brand/brand-list']);
        $materailManager = Url::to(['material/list']);
        $tanxManager = Url::to(['tanx-manage/list']);
        $userManager = Url::to(['users/user-list']);
        $log = Url::to(['operate-log/log-list']);
        $retarget = Url::to(['retarget/list']);
        $packManagement = Url::to(['pack/manage']);
        $appManagement = Url::to(['app/app-list']);

        $navProfit = "";
        $navAudit = "";
        $navBrand = "";
        $navTanx = "";
        $navUsers = "";
        $navLogs = "";
        $navRetarget = "";
        $navPack = "";
        $navApp = "";
        if($this->context->currentNav == 'profit-setting-nav'){
          $navProfit = " current";
        } else if ($this->context->currentNav == "solution-audit-nav") {
          $navAudit = " current";
        } else if ($this->context->currentNav == "brand-nav") {
          $navBrand = " current";
        } else if ($this->context->currentNav == "tanx-nav") {
          $navTanx = " current";
        } else if ($this->context->currentNav == "users-nav") {
          $navUsers = " current";
        } else if ($this->context->currentNav == "operate-log-nav") {
          $navLogs = " current";
        } else if ($this->context->currentNav == "operate-retarget-nav") {
          $navRetarget = " current";
        } else if ($this->context->currentNav == "pack-manage-nav") {
          $navPack = " current";
        } else if ($this->context->currentNav == "app-list-nav") {
          $navApp = " current";
        }

      $solutionAudit = \Yii::t('common', 'Solution Audit');
      $advertiserSync = \Yii::t('common', 'Brand');
      $userManagement = \Yii::t('common', 'User');
      $logs = \Yii::t('common', 'Logs');
      $profitSet = \Yii::t('common', 'Profit Ratio Settings');
      $managePack = \Yii::t('common', 'Packs Management');
      $manageApp = \Yii::t('common', 'APP Management');
        $operaterMenu = <<<FINE
FINE;
        if (in_array($_SESSION['user_rank'], ['root', 'operator', 'agent']))
          echo $operaterMenu;

          $managePackMenus = <<<FINE
            <li class="nav-title">$managePack</li>
            <li class="$navPack">
              <a href="$packManagement">
                <i class="fa fa-briefcase"></i>
                $managePack
              </a>
            </li>
            <li class="$navApp">
              <a href="$appManagement">
                <i class="fa fa-cubes"></i>
                $manageApp
              </a>
            </li>
FINE;
        if (in_array($_SESSION['user_rank'], ['root', 'operator', 'agent']))
          echo $managePackMenus;

          $opMenus = <<<FINE
          <li class="nav-title">$profitSet</li>
          <li class="$navProfit">
            <a href="$profitSetting">
              <i class="fa fa-money"></i>
              $profitSet
            </a>
          </li>
FINE;
      if (in_array($_SESSION['user_rank'], ['root']))
        echo $opMenus;
        $solutionAuditMenu = <<<FINE
            <li class="nav-title">$solutionAudit</li>
            <li class="$navAudit">
              <a href="$solutionAuditManager" title="$solutionAudit">
                <i class="fa fa-thumb-tack"></i>
                $solutionAudit
              </a>
            </li> 
FINE;
        if (in_array($_SESSION['user_rank'], ['root']))
          echo $solutionAuditMenu;

        $adManagementMenu = <<<FINE
            <li class="nav-title">$advertiserSync</li>
            <li class="$navBrand">
              <a href="$advertiserManager" title="$advertiserSync">
                <i class="fa fa-tags"></i>
                $advertiserSync
              </a>
            </li> 
FINE;
        if (in_array($_SESSION['user_rank'], ['root', 'operator']))
          echo $adManagementMenu;

        $userManagementMenu = <<<FINE
            <li class="nav-title">$userManagement</li>
            <li class="$navUsers">
              <a href="$userManager" title="$userManagement">
                <i class="fa fa-users"></i>
                $userManagement
              </a>
            </li>
FINE;
        if (in_array($_SESSION['user_rank'], ['root']))
          echo $userManagementMenu;

        $logMenu = <<<FINE
            <li class="nav-title">$logs</li>
            <li class="$navLogs">
              <a href="$log" title="$logs">
                <i class="fa fa-hdd-o"></i>
                $logs
              </a>
            </li>
            <!-- <li class="nav-title">重定向管理</li>
            <li class="$navRetarget">
              <a href="$retarget">
                <i class="fa fa-crosshairs"></i>
                重定向管理
              </a>
            </li> -->
FINE;
        if (in_array($_SESSION['user_rank'], ['root', 'operator', 'agent']))
          echo $logMenu;

        $endMenu = <<<FINE
            </ul>
          </li>
FINE;
        if (in_array($_SESSION['user_rank'], ['root', 'operator', 'agent']))
          echo $endMenu;
        ?>

          <!-- ------------------ 运营管理 end ------------------ -->           
          <!-- ------------------ 同步管理 beg ------------------ -->
  <!--         <li class="<? if($this->context->currentHeader == 'header-sync'){echo " active";} ?>">
            <a href="javascript:void(0);" class="has-sub" title="<?=\Yii::t('common', 'Syncronization')?>">
              <i class="fa fa-exchange"></i>
              <span class="title"><?=\Yii::t('common', 'Syncronization')?></span>
              <span class="selected"></span>
              <span class="pull-right arrow">
              <i class="fa fa-chevron-right "></i>
            </span>
            </a>
            <ul class="list-unstyled sub-nav"> -->
        <?php 
        $resourceSync = Url::to(['resource-sync/sync-list']);
        $creativeSync = Url::to(['creative-sync/sync-list']);
        $launchRuleSync = Url::to(['package-sync/sync-list']);
      $adspaceSyncMenu = \Yii::t('common', 'Adspace');
      $creativeSyncMenu = \Yii::t('common', 'Creative');
      $packageSyncMenu = \Yii::t('common', 'Package');
        
        $navHeaderSync = "";
        $navResourceSync = "";
        $navCreativeSync = "";
        $navPackageSync = "";
        if($this->context->currentHeader == 'header-sync') $navHeaderSync = " active";
        if($this->context->currentNav == 'resource-sync-nav'){
          $navResourceSync = " current";
        } else if ($this->context->currentNav == "creative-sync-nav") {
          $navCreativeSync = " current";
        } else if ($this->context->currentNav == "launch-rule-sync-nav") {
          $navPackageSync = " current";
        }
        $sync = \Yii::t('common', 'Syncronization');  

        $syncMenu = <<<FINE
            <li class="$navHeaderSync">
              <a href="javascript:void(0);" class="has-sub" title="$sync">
                <i class="fa fa-exchange"></i>
                <span class="title">$sync</span>
                <span class="selected"></span>
                <span class="pull-right arrow">
                <i class="fa fa-chevron-right "></i>
              </span>
              </a>
              <ul class="list-unstyled sub-nav">
              <li class="nav-title">$adspaceSyncMenu</li>
              <li class="$navResourceSync">
                <a href="$resourceSync" title="$adspaceSyncMenu">
                  <i class="fa fa-star-o"></i>
                  $adspaceSyncMenu
                </a>
              </li>
              <li class="nav-title">$creativeSyncMenu</li>
              <li class="$navCreativeSync">
                <a href="$creativeSync" title="$creativeSyncMenu">
                  <i class="fa fa-paper-plane"></i>
                  $creativeSyncMenu
                </a>
              </li>
              <li class="nav-title">$packageSyncMenu</li>
              <li class="$navPackageSync">
                <a href="$launchRuleSync" title="$packageSyncMenu">
                  <i class="fa fa-plane"></i>
                  $packageSyncMenu
                </a>
              </li>
            </ul>
          </li>
FINE;
        if ($_SESSION['user_rank'] == 'root')
          echo $syncMenu;
        ?>
          <!-- ------------------ 同步管理 end ------------------ -->
          <!-- <li class="<? if($this->context->currentHeader == 'header-settings'){echo " active";} ?>">
            <a href="javascript:void(0);" class="has-sub" title="<?=\Yii::t('common', 'Settings')?>">
              <i class="fa fa-cogs"></i>
              <span class="title"><?=\Yii::t('common', 'Settings')?></span>
              <span class="selected"></span>
              <span class="pull-right arrow">
              <i class="fa fa-chevron-right "></i>
            </span>
            </a>
            <ul class="list-unstyled sub-nav">
              <li class="nav-title"><?=\Yii::t('common', 'Update Password')?></li>
              <li class="<? if($this->context->currentNav == 'modify-pwd-nav'){echo " current";} ?>">
                <a href="<?= Url::to(['home/user-update']);?>" title="<?=\Yii::t('common', 'Update Password')?>">
                  <i class="fa fa-lock"></i> <?=\Yii::t('common', 'Update Password')?>
                </a>
              </li>
            </ul>
          </li> -->
        </ul>
      </nav>
      <!-- /sidebar nav -->
    </div>
    <div class="cont">
      <div class="loading-wrap" id="global-loading-wrap"></div>
      <?= $this->render('_contentLoading') ?>
      <div class="content">
        <div class="container-fluid">
          <div class="row">
            <div class="col-sm-6">
              <?= Breadcrumbs::widget([
                'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
                'homeLink' => [
                  'encode' => false,
                  'label' => '<i class="fa fa-dashboard"></i> '.\Yii::t("common", "Home"),
                  'url' => ['home/dashboard']
                ]
              ]) ?>
            </div>
            <div class="col-sm-6 col-xs-12 <? if(!$this->context->brandShow) echo "hidden";?> ">
              <div class="advertiser-select col-md-8 col-xs-12 pull-right">
                <div class="form-horizontal">
                  <div class="form-group mb0">
                    <label id="label" class="col-sm-6 control-label text-right col-xs-4 pr0"><?=\Yii::t("common", "Switch Brand")?>：</label>
                    <div class="col-sm-6 col-xs-8 pl0">                      
                      <select name="advertiserName" id="brand-name-switch" class="form-control input-sm col-sm-6">
                        <?php
                          $currentAdvertiserId = '';
                          if (isset($_SESSION['advertiser_id'])) {
                            $currentAdvertiserId = $_SESSION['advertiser_id'];
                          }
                          $all = \Yii::t('common', 'All');
                          echo "<option value='0' >$all</option>";
                          foreach ($_SESSION['domainAdvertisers'] as $advertiser) {
                            $id = $advertiser['id'];
                            $name = $advertiser['name'];
                            $isSelected = '';
                            if ($id == $currentAdvertiserId) {
                              $isSelected = "selected";
                            }
                            echo "<option value='$id' $isSelected>$name</option>";
                          }
                        ?>
                      </select>
                     </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <!-- </div> -->
          <?= $content ?>
        </div>
      </div>
    </div>
  </div>
  <?= $this->render('_footer') ?>
  <?= $this->render('_backToTop') ?>
<?php $this->endBody() ?>
<?= $this->render('_baiduAnalytics') ?>
</body>
</html>
<?php $this->endPage() ?>
